{include file="common/header" /}

<body>
<head>
  {include file="common/personal_top" /}
<div class="user_style clearfix">
 <div class="user_center clearfix">
   {include file="common/center" /}
 </div>
 <!--右侧样式-->
  <div class="right_style">
  <div class="title_style"><em></em>订单管理</div> 
   <div class="Order_form_style">
      <div class="Order_form_filter">
       <a href="#" class="on">全部订单（{$count}）</a>
       <a href="#" class="">未完成（{$no_finish|count}）</a>
       <a href="#" class="">待付款（{$no_pay|count}）</a>
       <a href="#" class="">待发货（{$no_mail|count}）</a>
       <a href="#" class="">待收货（{$take_over|count}）</a>  
      </div>
      <div class="Order_Operation">
     <div class="left"> <label><input name="" type="checkbox" value=""  class="checkbox"/>全选</label> <input name="" type="submit" value="批量确认收货"  class="confirm_Order"/></div>
     <div class="right_search"><input name="" type="text"  class="add_Ordertext" placeholder="请输入产品标题或订单号进行搜索"/><input name="" type="submit" value="搜索订单"  class="search_order"/></div>
      </div>
      <div class="Order_form_list">
        <table>
          <thead>
            <tr>
              <td class="list_name_title0">商品</td>
              <td class="list_name_title1">单价(元)</td>
              <td class="list_name_title2">数量</td>
              <td class="list_name_title4">实付款(元)</td>
              <td class="list_name_title5">订单状态</td>
              <td class="list_name_title6">操作</td>
            </tr>
          </thead>
        {volist name="orders" id="vo"} 
        <tbody>       
          <tr class="Order_info">
            <td colspan="6" class="Order_form_time"><input name="" type="checkbox" value=""  class="checkbox"/>下单时间：{$vo.create_time} | 订单号：{$vo.order_no} <em></em>
            </td>
          </tr>
          <tr class="Order_Details">
            <td colspan="3">
              <table class="Order_product_style">
                <tbody>
                <tr>
                  <td><div class="product_name clearfix"><a href="#" class="product_img"><img src="{$vo.picture}" width="80px" height="80px"></a><a href="3" class="p_name">{$vo.gname}</a></div>
                  </td>
                  <td>{$vo.price}</td>
                  <td>{$vo.num}</td>
                </tr>
                </tbody>
              </table>
            </td>   
            <td class="split_line">{$vo.total_price}</td>
            <td class="split_line"><p style="color:#F30">{$vo.status|orderStatus}</p></td>
            <td class="operating">
              {if $vo.status == 0}
              <a href="{:url('order/index',['order_no'=>$vo.order_no])}">去完成>></a>
              <a class="delete_order" attr-no="{$vo.order_no}" href="javascript:void(0)">删除</a>
              {elseif $vo.status == 1}
              <a href="{:url('order/order_pay',['order_no'=>$vo.order_no])}">去付款>></a>
              {elseif $vo.status == 2}
              <a href="">提醒发货</a>
              {elseif $vo.status == 3}
              <a href="">查看物流</a>
              <a class="queren" attr-no="{$vo.order_no}"  href="javascript:void(0)">确认收货</a>
              {elseif $vo.status == 4}
              <a class="pingjia" href="{:url('goods/goods_comment',['id'=>$vo.gid])}">去评价>></a>
              {elseif $vo.status == 5}
              已评价
              <a class="pingjia" href="{:url('goods/goods_comment',['id'=>$vo.gid])}">查看评论>></a>
              {/if}
            </td>
          </tr>
      </tbody>
      {/volist}
      </table>
      </div>
      <div class="tp5-o2o">{$orders->render()}</div>
     </div>
   </div>
<script>
$(function(){
    $('.operating .queren').click(function(){
        var conf = confirm('确认收货之后，钱将会打给卖家，确认吗？');
        if (conf) {
            var order_no = $(this).attr('attr-no');
            var url = "{:url('order/confirm')}";
            var data = {'order_no':order_no};
            $.post(url,data,function(result){
                if (result.code == 1) {
                    location.href = result.data;
                }else if(result.code == 0){
                    alert(result.msg);
                }
            },'json')
        }
    });

    $('.operating .delete_order').click(function(){
        var conf = confirm('删除之后订单无法恢复，确认吗？');
        if (conf) {
            var order_no = $(this).attr('attr-no');
            var url = "{:url('order/delete')}";
            var data = {'order_no':order_no};
            $.post(url,data,function(result){
                if (result.code == 1) {
                    location.href = result.data;
                }else if(result.code == 0){
                    alert(result.msg);
                }
            },'json')
        }
    })
})
</script>
<script>
$(document).ready(function(){
    $('.Order_form_style input').iCheck({
      checkboxClass: 'icheckbox_flat-green',
      radioClass: 'iradio_flat-green'
    });
});
</script>
  </div>
 </div>
</div>
{include file="common/footer" /}
</body>
</html>
